package com.tmzn.controller;

import com.tmzn.entity.param.LoginParam;
import com.tmzn.entity.param.RegisterParam;
import com.tmzn.service.UserService;
import com.tmzn.transdata.RpcResult;
import com.tmzn.web.annotation.Anonymous;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    UserService userService;

    @Anonymous
    @RequestMapping
    public RpcResult login(@RequestBody LoginParam loginParam){
        RpcResult login = userService.login(loginParam);
        return login;
    }


    @Anonymous
    @RequestMapping("/register")
    public RpcResult regsiter(@RequestBody RegisterParam registerParam){
        RpcResult register = userService.register(registerParam);
        return register;
    }

    @Anonymous
    @RequestMapping("/sendCode")
    public RpcResult sendCode(@RequestBody RegisterParam registerParam){
        RpcResult register = userService.sendCode(registerParam);
        return register;
    }


    @Anonymous
    @RequestMapping("/forgetPwd")
    public RpcResult forgetPwd(@RequestBody RegisterParam registerParam){
        RpcResult forgetPwd = userService.forgetPwd(registerParam);
        return forgetPwd;
    }


}
